package com.snopy.concurrency.hashmap;

import lombok.extern.slf4j.Slf4j;

import java.io.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;


/**
 * @author snopy
 * @version 1.0.0
 * @classname Test1
 * @description
 * @email 77912204@qq.com
 * @date 2022/06/30 17:46
 */
@Slf4j
public class Test1 {
    static final String ALPHA = "abcdefghijklmnopqrstuvwxyz";
    public static void main(String[] args) throws IOException {
        /*try {
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(
                    "F:\\workspaceA\\Sonata\\Sonata_test\\src\\main\\resources\\buffer.txt")));
            log.debug("{}",bufferedReader);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }*/
        int length = ALPHA.length();
        int count = 200;
        List<String> list = new ArrayList<>(length*count);
        for (int i = 0; i < length; i++) {
            char ch = ALPHA.charAt(i);
            for (int j = 0; j < count; j++) {
                list.add(String.valueOf(ch));
            }
        }
        Collections.shuffle(list);
        for (int i = 0; i < 26; i++) {
            try(PrintWriter out = new PrintWriter(
             new OutputStreamWriter(
                     new FileOutputStream("F:/workspaceA/Sonata/Sonata_test/src/main/resources/temp/"+(i+1)+".txt")))) {
                    String collect = String.join("\r", list.subList(i * count, (i + 1) * count));
                    out.print(collect);
            }catch (IOException ignore){}
        }


    }

}
